from odoo import api, fields, models


class Feel(models.Model):
    _name = "bad.feel"
    _description = "the terrible feelings after vaccine"
    feeling_id = fields.Char(
        string='不良反应/事件编号',
        index=True,
        readonly=True,
    )

    @api.model
    def create(self, vals):
        vals['feeling_id'] = self.env['ir.sequence'].next_by_code('bad.feel') or ''
        return super(Feel, self).create(vals)

    name = fields.Char(
        string='不良反应/事件名称',
        required=True
    )
    start_datetime = fields.Datetime(
        string='发生时间',
        required=True,
        index=True
    )
    known_datetime = fields.Datetime(
        string='申办者获知时间',
        required=True,
        index=True,
    )
    des_procedure = fields.Html(
        string='过程描述',
        help='包括症状、体征、临床检验、发生场合和国家等、处理情况、不良反应/事件的国内外报道情况(可附页)',
        required=True,
    )
    result = fields.Selection([
        ('healthy', '痊愈'),
        ('better', '好转'),
        ('noGood', '未好转'),
        ('unknown', '不详'),
        ('sthLeft', '有后遗症'),
        ('die', '死亡')
    ], string='结果', defaut='0', index=True)
    sthLeftShow = fields.Text(
        string='表现(有后遗症则填)'
    )
    die_reason = fields.Text(
        string='直接死因(死亡则填)'
    )
    die_datetime = fields.Datetime(
        string='死亡时间(死亡则填)'
    )
    Isbetter = fields.Selection([
        ('yes', '是'),
        ('no', '否'),
        ('unknown', '不明'),
        ('ing', '未停药或未减量')
    ], string='停药或减量后，反应/事件是否消失或减轻？', required=True, )
    stillAgain = fields.Selection([
        ('yes', '是'),
        ('no', '否'),
        ('unknown', '不明'),
        ('noUse', '未再使用')
    ], string='再次使用可疑药品后是否再次出现同样反应/事件？', required=True, )
    developer_words = fields.Selection([
        ('yes', '肯定'),
        ('possible', '很可能'),
        ('maybe', '可能'),
        ('no', '可能无关')
    ], string='研究者评价', required=True)
    applier_words = fields.Selection([
        ('yes', '肯定'),
        ('possible', '很可能'),
        ('maybe', '可能'),
        ('no', '可能无关')
    ], string='申办者评价', required=True)
    influence = fields.Selection([
        ('yes', '有'),
        ('no', '无')
    ], string='本例不良反应对疫苗的既有风险利益评估有所影响？')
    influence_other = fields.Text(
        string='其他'
    )
    Iscontinue = fields.Selection([
        ('yes', '继续'),
        ('no', '暂停')
    ], string='本次临床试验是否暂停或继续？')
    Iscontinue_other = fields.Text(
        string='其他'
    )
